package com.cy.store.Service;


import com.cy.store.Entity.User;
import com.cy.store.Service.Ex.*;

/**
 * 用户模块业务层接口
 */
public interface IUserService {
    //用户注册方法
    void reg(User user) throws UsernameDuplicatedException, InsertException;

    /**
     * 用户登录
     * @param username
     * @param password
     * @return 当前匹配的用户数据，没有则返回null
     * @throws UsernameDuplicatedException
     * @throws InsertException
     */
    User login(String username,String password) throws UsernameDuplicatedException, InsertException, UserNotFoundException, PasswordNotMatchException;


    void changePassword(Integer uid,String username,String oldpassword
            ,String newpassword) throws UserNotFoundException, PasswordNotMatchException, UpdateException;

    /**
     * 更具用户的id查询用户数据
     * @param uid 用户uid
     * @return 用户数据
     */
    User getByUid(Integer uid) throws UserNotFoundException;

    //修改用户资料
    void changeInfo(Integer uid,String name,User user) throws UserNotFoundException, UpdateException;


    /**
     * 更换用户头像
     * @param uid
     * @param avatar
     * @param username
     * @throws UserNotFoundException
     * @throws UpdateException
     */
    void changeAvatar(Integer uid,String avatar,String username) throws UserNotFoundException, UpdateException;
}
